package io;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import main.Game;
import main.ThinGame;

public class ClientShipListener {
	private SeanKeyListener listen = SeanKeyListener.getInstance();
	
	public static final int UP = 38;
	public static final int DOWN = 39;
	public static final int LEFT = 37;
	public static final int RIGHT = 40;
	
	public static final int BACKSLASH = 92;
	
	public ClientShipListener() {
		ThinGame.game.getWindow().addKeyListener(listen);
	}
	
	public void update() {
		int player = ThinGame.game.getShip().getPlayer();
		if(listen.isKeyDown(39)) {
			ThinGame.game.sendMessage("Rotate " + player + " 1");
		}
		if(listen.isKeyDown(38)) {
			ThinGame.game.sendMessage("Acc " + player + " 1");
		}
		if(listen.isKeyDown(37)) {
			ThinGame.game.sendMessage("Rotate " + player + " -1");
		}
		if(listen.isKeyDown(40)) {
			ThinGame.game.sendMessage("Acc " + player + " -1");
		}
		if(listen.isKeyDown(BACKSLASH)) {
			ThinGame.game.sendMessage("Jump " + player);
		}

		if(listen.isKeyDown(32)) {
			ThinGame.game.sendMessage("Fire " + player);
		}
		listen.update();
	}
	
	
}
